}
static gint
-gdk_offscreen_window_get_origin (GdkWindow *window,
- gint *x,
- gint *y)
+gdk_offscreen_window_get_root_coords (GdkWindow *window,
+ gint x,
+ gint y,
+ gint *root_x,
+ gint *root_y)
{
GdkWindow *parent;
int tmpx, tmpy;
- tmpx = 0;
- tmpy = 0;
+ tmpx = x;
+ tmpy = y;
parent = get_offscreen_parent (window);
if (parent)
{
double dx, dy;
- gdk_window_get_origin (parent,
- &tmpx, &tmpy);
-
to_parent (window,
- 0, 0,
+ x, y,
&dx, &dy);
- tmpx = floor (tmpx + dx + 0.5);
- tmpy = floor (tmpy + dy + 0.5);
- }
+ tmpx = floor (dx + 0.5);
+ tmpy = floor (dy + 0.5);
+ gdk_window_get_root_coords (parent,
+ tmpx, tmpy,
+ &tmpx, &tmpy);
+ }
- if (x)
- *x = tmpx;
- if (y)
- *y = tmpy;
+ if (root_x)
+ *root_x = tmpx;
+ if (root_y)
+ *root_y = tmpy;
return TRUE;
}
iface->set_static_gravities = gdk_offscreen_window_set_static_gravities;
iface->queue_antiexpose = gdk_offscreen_window_queue_antiexpose;
iface->queue_translation = gdk_offscreen_window_queue_translation;
- iface->get_origin = gdk_offscreen_window_get_origin;
+ iface->get_root_coords = gdk_offscreen_window_get_root_coords;
iface->get_deskrelative_origin = gdk_offscreen_window_get_deskrelative_origin;
iface->get_pointer = gdk_offscreen_window_get_pointer;
iface->destroy = gdk_offscreen_window_destroy;
private = (GdkWindowObject *) window;
- GDK_WINDOW_IMPL_GET_IFACE (private->impl)->get_origin (window, x, y);
+ GDK_WINDOW_IMPL_GET_IFACE (private->impl)->get_root_coords (window,
+ private->abs_x,
+ private->abs_y,
+ x, y);
- if (x)
- *x += private->abs_x;
- if (y)
- *y += private->abs_y;
+ return TRUE;
+}
+
+/**
+ * gdk_window_get_root_coords:
+ * @window: a #GdkWindow
+ * @x: X coordinate in window
+ * @y: Y coordinate in window
+ * @root_x: return location for X coordinate
+ * @root_y: return location for Y coordinate
+ *
+ * Obtains the position of a window position in root
+ * window coordinates. This is similar to
+ * gdk_window_get_origin() but allows you go pass
+ * in any position in the window, not just the origin.
+ *
+ * Return value: not meaningful, ignore
+ */
+gint
+gdk_window_get_root_coords (GdkWindow *window,
+ gint x,
+ gint y,
+ gint *root_x,
+ gint *root_y)
+{
+ GdkWindowObject *private;
+
+ g_return_val_if_fail (GDK_IS_WINDOW (window), 0);
+
+ private = (GdkWindowObject *) window;
+
+ GDK_WINDOW_IMPL_GET_IFACE (private->impl)->get_root_coords (window,
+ x + private->abs_x,
+ y + private->abs_y,
+ root_x, root_y);
return TRUE;
}
gint gdk_window_get_origin (GdkWindow *window,
gint *x,
gint *y);
+gint gdk_window_get_root_coords (GdkWindow *window,
+ gint x,
+ gint y,
+ gint *root_x,
+ gint *root_y);
#if !defined (GDK_DISABLE_DEPRECATED) || defined (GTK_COMPILATION)
/* Used by gtk_handle_box_button_changed () */
gint *width,
gint *height,
gint *depth);
- gint (* get_origin) (GdkWindow *window,
- gint *x,
- gint *y);
+ gint (* get_root_coords) (GdkWindow *window,
+ gint x,
+ gint y,
+ gint *root_x,
+ gint *root_y);
gint (* get_deskrelative_origin) (GdkWindow *window,
gint *x,
gint *y);
}
static gint
-gdk_window_x11_get_origin (GdkWindow *window,
- gint *x,
- gint *y)
+gdk_window_x11_get_root_coords (GdkWindow *window,
+ gint x,
+ gint y,
+ gint *root_x,
+ gint *root_y)
{
gint return_val;
Window child;
return_val = XTranslateCoordinates (GDK_WINDOW_XDISPLAY (window),
GDK_WINDOW_XID (window),
GDK_WINDOW_XROOTWIN (window),
- 0, 0, &tx, &ty,
+ x, y, &tx, &ty,
&child);
}
else
return_val = 0;
- if (x)
- *x = tx;
- if (y)
- *y = ty;
+ if (root_x)
+ *root_x = tx;
+ if (root_y)
+ *root_y = ty;
return return_val;
}
iface->reparent = gdk_window_x11_reparent;
iface->set_cursor = gdk_window_x11_set_cursor;
iface->get_geometry = gdk_window_x11_get_geometry;
- iface->get_origin = gdk_window_x11_get_origin;
+ iface->get_root_coords = gdk_window_x11_get_root_coords;
iface->get_pointer = gdk_window_x11_get_pointer;
iface->get_deskrelative_origin = gdk_window_x11_get_deskrelative_origin;
iface->shape_combine_region = gdk_window_x11_shape_combine_region;